{% extends 'base.html' %}
{% block header %}
    {{ year}}年{{ month }}月
{% endblock %}
{% block content %}
    <div class="row">
        {% for m in months %}
            <div class="col">
                {% ifequal m month %}
                    <a href="/archives/2021/{{m}}" role="button" class="btn btn-success btn-small btn-block">
                        {{ m }}月
                    </a>
                {% else %}
                    <a href="/archives/2021/{{m}}" role="button" class="btn btn-outline-secondary btn-small btn-block">
                        {{ m }}月
                    </a>
                {% endifequal %}
            </div>
        {% endfor %}
    </div>
    {% for article in articles %}
        <div class="card mt-2 mb-2 border-warning">
            <div class="card-body">
                <h4 class="card-title">
                    <span class="badge badge-danger">
                        {{ article.get_category_display }}
                    </span>
                    <a href="/article/{{article.article_id}}">
                        {{ article.title }}
                    </a>
                </h4>
                <p class="card-text">
                    {{ article.content|truncatechars:20 }}...
                </p>
                <small>
                    {{ article.post_datetime }}
                    阅读数：{{ article.read_count }}
                </small>
            </div>
        </div>
    {% endfor %}
{% endblock %}